package br.com.aeon.view.flex.enum
{
	public class Situacao {
		public static const DEFAULT:Situacao = new Situacao("Selecione um item", null);
		public static const ATRASADO:Situacao = new Situacao("Atrasado", "ATRASADO");
		public static const EMDIA:Situacao = new Situacao("EM DIA", "EMDIA");
		
		public var label:String;
		public var value:String;
 
		public function Situacao(label:String, value:String) {
			this.label = label;
			this.value = value;
		}
 
		public static function get list1():Array {
			return [ATRASADO, EMDIA];
		}
 
		public static function get list2():Array {
			return [DEFAULT, ATRASADO, EMDIA];
		}  

		public static function selectByValue(value:String):Situacao {
			for each(var enun:Situacao in Situacao.list1) {
				if(value == enun.value)
					return enun;
			}
 			return null;
		}
 
		public static function getIndexByValue(value:String, init:int):int {
			var i:int = init;
			for each(var enun:Situacao in Situacao.list1) {
				if(value == enun.value)
					return i;
				i++;
			}
 			return 0;
		}
 
		public static function getValueByIndex(index:int, init:int):String {
			var i:int = init;
			for each(var enun:Situacao in Situacao.list1) {
				if(i == index)
					return enun.value;
				i++;
			}
 			return null;
		}
 	}
}